Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify Worker Environment Variables systemd/k8s #23197

Merged

Conversation

agrare
Copy link
Member

@agrare agrare commented Sep 20, 2024

Handling of worker environment variables was spread across a number of different locations and in a number of cases had to be duplicated for systemd/kubernetes.

This adds a common MiqWorker#environment_variables method that applies to all runtime platforms, as well as specific
systemd/container_environment_variables which are merged in depending on the runtime environment.

TODO:

Live test of standard workers, provider workers, opentofu-runner on:

  • appliances
  • podified
  • dev-process

Dependent:

@@ -5,7 +5,6 @@ module DeploymentPerWorker
def create_container_objects
ContainerOrchestrator.new.create_deployment(worker_deployment_name) do |definition|
configure_worker_deployment(definition, 1)
definition[:spec][:template][:spec][:containers].first[:env] << {:name => "EMS_ID", :value => self.class.ems_id_from_queue_name(queue_name)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what bothered me originally, we already have EMS_ID env var handling for systemd in the per_ems_worker_mixin so I thought we should be able to let the worker class define this rather than DeploymentPerWorker

@agrare agrare changed the title Unify Worker Environment Variables systemd/k8s [WIP] Unify Worker Environment Variables systemd/k8s Sep 20, 2024
@miq-bot miq-bot added the wip label Sep 20, 2024
@agrare agrare force-pushed the refactor_worker_environment_variables branch 5 times, most recently from 9a565b6 to 0e017ce Compare September 24, 2024 16:29
@Fryguy
Copy link
Member

Fryguy commented Sep 24, 2024

This is great!

@agrare agrare force-pushed the refactor_worker_environment_variables branch from 0e017ce to 55732aa Compare September 25, 2024 19:31
@agrare agrare force-pushed the refactor_worker_environment_variables branch 2 times, most recently from f2fdad8 to 6524d81 Compare September 26, 2024 14:03
Handling of worker environment variables was spread across a number of
different locations and in a number of cases had to be duplicated for
systemd/kubernetes.

This adds a common `MiqWorker#environment_variables` method that applies
to all runtime platforms, as well as specific
systemd/container_environment_variables which are merged in depending on
the runtime environment.
@agrare agrare force-pushed the refactor_worker_environment_variables branch from 6524d81 to 80d99c9 Compare September 26, 2024 14:04
@miq-bot
Copy link
Member

miq-bot commented Sep 26, 2024

Checked commit agrare@80d99c9 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
7 files checked, 0 offenses detected
Everything looks fine. 🍪

@agrare agrare changed the title [WIP] Unify Worker Environment Variables systemd/k8s Unify Worker Environment Variables systemd/k8s Sep 26, 2024
@agrare agrare removed the wip label Sep 26, 2024
@agrare
Copy link
Member Author

agrare commented Sep 26, 2024

Okay I've tested this on openshift/appliances/local-development-environment and all runs correctly, taking out of WIP

@kbrock kbrock merged commit 4e9403a into ManageIQ:master Sep 30, 2024
8 checks passed
@kbrock kbrock self-assigned this Sep 30, 2024
@agrare agrare deleted the refactor_worker_environment_variables branch September 30, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants